package cn.rslee.demo.spring.jpa.service;

import javax.annotation.Resource;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Component;

import cn.rslee.demo.spring.jpa.entity.AccessLog;
import cn.rslee.demo.spring.jpa.repository.AccessLogRepository;

/**
 * 描述：
 * 
 * <pre>HISTORY
 * ****************************************************************************
 *  ID   DATE                    PERSON          REASON
 *  1    2016年5月26日         rslee               Create
 * ****************************************************************************
 * </pre>
 * @author rslee
 * @since 1.0
 */
@Component("accessLogSortService")
public class AccessLogSortServiceImpl implements AccessLogSortService  {
	
	@Resource
	private AccessLogRepository accessLogRepository;

	@Override
	public Page<AccessLog> findUsernameByPage(String username, int page, int size) {
		return accessLogRepository.findByUsernameOrderByVisitTmDesc(username, new PageRequest(page,size));
	}

}
